package com.zz.Calendar;

import java.util.Calendar;
import java.util.Date;

public class Test {
    public static void main(String args[]){
        //获得系统此时对应的日历对象
        Calendar now = Calendar.getInstance();
        System.out.println(now);

        //获取日历中的某个信息
        int year = now.get(Calendar.YEAR);
        System.out.println(year);

        int days = now.get(Calendar.DAY_OF_WEEK);
        System.out.println(days);

        //拿到日历中记录的日期对象
        Date d = now.getTime();
        System.out.println(d);

        //修改日历中的某个信息
        now.set(Calendar.MONTH, 9);//修改月份成10月份
        System.out.println(now);

        //位某个信息增加或者减少多少
        now.add(Calendar.DAY_OF_WEEK, 30);
    }
}
